﻿using System;
using Windows.UI;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Media;
using XamlInspector.Model;

namespace XamlInspector.Presentation.Converters
{
    public class PropertyToBindingRectConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            var xamlProperty = value as XamlProperty;
            if (xamlProperty != null)
            {
                if (xamlProperty.IsDataBound)
                {
                    return new SolidColorBrush(Colors.Orange);
                }
                if (xamlProperty.IsLocalValue)
                {
                    return new SolidColorBrush(Colors.Black);
                }
            }
            return new SolidColorBrush(Colors.LightGray);
        }

        public object ConvertBack(object value, Type targetType, object parameter, string language)
        {
            throw new NotImplementedException();
        }
    }
}
